package gui.tradeoptions;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.net.URL;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

import commondata.IPlayer;

public class PlayerDetailsPanel extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/** The picture label. */
	private JLabel pictureLabel = null;

	/** The player name label. */
	private JLabel playerNameLabel = null;

	/** The win label. */
	private JLabel heightLabel = null;

	/** The lost label. */
	private JLabel weightLabel = null;

	/** The budget label. */
	private JLabel wageLabel = null;

	/** The payroll label. */
	private JLabel collegeLabel = null;

	/** The win value label. */
	private JLabel heightValueLabel = null;

	/** The lost value label. */
	private JLabel weightValueLabel = null;

	/** The budget value label. */
	private JLabel wageValueLabel = null;

	/** The payroll value label. */
	private JLabel collegeValueLabel = null;

	/** The points label. */
	private JLabel pointsLabel = null;

	/** The assists label. */
	private JLabel assistsLabel = null;

	/** The rebounds label. */
	private JLabel reboundsLabel = null;

	/** The blocks label. */
	private JLabel blocksLabel = null;

	/** The points value label. */
	private JLabel pointsValueLabel = null;

	/** The assists value label. */
	private JLabel assistsValueLabel = null;

	/** The rebounds value label. */
	private JLabel reboundsValueLabel = null;

	/** The blocks value label. */
	private JLabel blocksValueLabel = null;

	private JLabel jerseyNumberLabel = null;

	private JLabel ageLabel = null;

	private JLabel ageValueLabel = null;

	private JLabel positionLabel = null;

	private JLabel positionValueLabel = null;

	private JLabel jLabel = null;

	/**
	 * This method initializes
	 * 
	 */
	public PlayerDetailsPanel() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 */
	private void initialize() {
		GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
		gridBagConstraints15.gridx = 5;
		gridBagConstraints15.weightx = 1.0D;
		gridBagConstraints15.weighty = 1.0D;
		gridBagConstraints15.fill = GridBagConstraints.BOTH;
		gridBagConstraints15.gridy = 6;
		jLabel = new JLabel();
		jLabel.setText("");
		GridBagConstraints gridBagConstraints61 = new GridBagConstraints();
		gridBagConstraints61.gridx = 4;
		gridBagConstraints61.anchor = GridBagConstraints.NORTHEAST;
		gridBagConstraints61.insets = new Insets(0, 0, 0, 5);
		gridBagConstraints61.gridy = 1;
		positionValueLabel = new JLabel();
		positionValueLabel.setFont(new Font("DialogInput", Font.PLAIN, 12));
		positionValueLabel.setText("4111111");
		GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
		gridBagConstraints51.gridx = 3;
		gridBagConstraints51.insets = new Insets(0, 15, 5, 5);
		gridBagConstraints51.anchor = GridBagConstraints.NORTHWEST;
		gridBagConstraints51.gridy = 1;
		ageValueLabel = new JLabel();
		ageValueLabel.setFont(new Font("DialogInput", Font.PLAIN, 12));
		ageValueLabel.setText("411111");
		ageLabel = new JLabel();
		ageLabel.setText("Age :");
		GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
		gridBagConstraints21.gridx = 3;
		gridBagConstraints21.anchor = GridBagConstraints.SOUTHWEST;
		gridBagConstraints21.insets = new Insets(10, 15, 10, 10);
		gridBagConstraints21.gridy = 0;
		jerseyNumberLabel = new JLabel();
		jerseyNumberLabel.setText("#");
		GridBagConstraints gridBagConstraints = new GridBagConstraints();
		gridBagConstraints.gridx = 1;
		gridBagConstraints.gridwidth = 2;
		gridBagConstraints.insets = new Insets(10, 10, 10, 10);
		gridBagConstraints.gridy = 0;
		pictureLabel = new JLabel();
		Dimension dimension2 = new Dimension(135, 120);
		pictureLabel.setPreferredSize(dimension2);
		pictureLabel.setSize(dimension2);
		pictureLabel.setMinimumSize(dimension2);
		pictureLabel.setText("PICTURE");
		GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
		gridBagConstraints14.gridx = 4;
		gridBagConstraints14.anchor = GridBagConstraints.NORTHEAST;
		gridBagConstraints14.insets = new Insets(0, 0, 0, 5);
		gridBagConstraints14.gridy = 5;
		blocksValueLabel = new JLabel();
		blocksValueLabel.setFont(new Font("DialogInput", Font.PLAIN, 12));
		blocksValueLabel.setText("41111111");
		GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
		gridBagConstraints13.gridx = 4;
		gridBagConstraints13.anchor = GridBagConstraints.NORTHEAST;
		gridBagConstraints13.insets = new Insets(0, 0, 0, 5);
		gridBagConstraints13.gridy = 4;
		reboundsValueLabel = new JLabel();
		reboundsValueLabel.setFont(new Font("DialogInput", Font.PLAIN, 12));
		reboundsValueLabel.setText("41111111");
		GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
		gridBagConstraints12.gridx = 4;
		gridBagConstraints12.anchor = GridBagConstraints.NORTHEAST;
		gridBagConstraints12.insets = new Insets(0, 0, 0, 5);
		gridBagConstraints12.gridy = 3;
		assistsValueLabel = new JLabel();
		assistsValueLabel.setFont(new Font("DialogInput", Font.PLAIN, 12));
		assistsValueLabel.setText("4111111");
		GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
		gridBagConstraints11.gridx = 4;
		gridBagConstraints11.anchor = GridBagConstraints.NORTHEAST;
		gridBagConstraints11.insets = new Insets(0, 0, 0, 5);
		gridBagConstraints11.gridy = 2;
		pointsValueLabel = new JLabel();
		pointsValueLabel.setFont(new Font("DialogInput", Font.PLAIN, 12));
		pointsValueLabel.setText("41111111");
		GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
		gridBagConstraints10.gridx = 3;
		gridBagConstraints10.insets = new Insets(0, 15, 5, 0);
		gridBagConstraints10.anchor = GridBagConstraints.NORTHWEST;
		gridBagConstraints10.gridy = 5;
		blocksLabel = new JLabel();
		blocksLabel.setText("BPG :");
		GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
		gridBagConstraints9.gridx = 3;
		gridBagConstraints9.anchor = GridBagConstraints.NORTHWEST;
		gridBagConstraints9.insets = new Insets(0, 15, 5, 20);
		gridBagConstraints9.gridy = 4;
		reboundsLabel = new JLabel();
		reboundsLabel.setText("RPG :");
		GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
		gridBagConstraints8.gridx = 3;
		gridBagConstraints8.anchor = GridBagConstraints.NORTHWEST;
		gridBagConstraints8.insets = new Insets(0, 15, 5, 0);
		gridBagConstraints8.gridy = 3;
		assistsLabel = new JLabel();
		assistsLabel.setText("APG :");
		GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
		gridBagConstraints7.gridx = 3;
		gridBagConstraints7.insets = new Insets(0, 15, 5, 0);
		gridBagConstraints7.anchor = GridBagConstraints.NORTHWEST;
		gridBagConstraints7.gridy = 2;
		pointsLabel = new JLabel();
		pointsLabel.setText("PPG :");
		GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
		gridBagConstraints6.gridx = 2;
		gridBagConstraints6.anchor = GridBagConstraints.NORTHEAST;
		gridBagConstraints6.insets = new Insets(0, 0, 0, 10);
		gridBagConstraints6.gridy = 5;
		collegeValueLabel = new JLabel();
		collegeValueLabel.setFont(new Font("DialogInput", Font.PLAIN, 12));
		collegeValueLabel.setText("41.1111111");
		GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
		gridBagConstraints5.gridx = 2;
		gridBagConstraints5.anchor = GridBagConstraints.NORTHEAST;
		gridBagConstraints5.insets = new Insets(0, 0, 0, 10);
		gridBagConstraints5.gridy = 4;
		wageValueLabel = new JLabel();
		wageValueLabel.setFont(new Font("DialogInput", Font.PLAIN, 12));
		wageValueLabel.setText("41.000.000");
		GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
		gridBagConstraints41.gridx = 2;
		gridBagConstraints41.anchor = GridBagConstraints.NORTHEAST;
		gridBagConstraints41.insets = new Insets(0, 0, 0, 10);
		gridBagConstraints41.gridy = 3;
		weightValueLabel = new JLabel();
		weightValueLabel.setFont(new Font("DialogInput", Font.PLAIN, 12));
		weightValueLabel.setText("41111");
		GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
		gridBagConstraints31.gridx = 2;
		gridBagConstraints31.anchor = GridBagConstraints.NORTHEAST;
		gridBagConstraints31.insets = new Insets(0, 0, 0, 10);
		gridBagConstraints31.gridy = 2;
		GridBagConstraints gridBagConstraints37 = new GridBagConstraints();
		gridBagConstraints37.gridx = 2;
		gridBagConstraints37.anchor = GridBagConstraints.NORTHEAST;
		gridBagConstraints37.insets = new Insets(0, 0, 0, 10);
		gridBagConstraints37.gridy = 1;
		heightValueLabel = new JLabel();
		heightValueLabel.setText("411111");
		heightValueLabel.setFont(new Font("DialogInput", Font.PLAIN, 12));
		GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
		gridBagConstraints4.gridx = 1;
		gridBagConstraints4.anchor = GridBagConstraints.NORTHWEST;
		gridBagConstraints4.insets = new Insets(0, 10, 5, 0);
		gridBagConstraints4.gridy = 5;
		collegeLabel = new JLabel();
		collegeLabel.setText("College :");
		GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
		gridBagConstraints3.gridx = 1;
		gridBagConstraints3.anchor = GridBagConstraints.NORTHWEST;
		gridBagConstraints3.insets = new Insets(0, 10, 5, 5);
		gridBagConstraints3.gridy = 4;
		wageLabel = new JLabel();
		wageLabel.setText("Wage ($):");
		GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
		gridBagConstraints2.gridx = 1;
		gridBagConstraints2.anchor = GridBagConstraints.NORTHWEST;
		gridBagConstraints2.insets = new Insets(0, 10, 5, 0);
		gridBagConstraints2.gridy = 3;
		weightLabel = new JLabel();
		weightLabel.setText("Weight :");
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
		gridBagConstraints1.gridx = 1;
		gridBagConstraints1.anchor = GridBagConstraints.NORTHWEST;
		gridBagConstraints1.insets = new Insets(0, 10, 5, 0);
		gridBagConstraints1.gridy = 2;
		GridBagConstraints gridBagConstraints17 = new GridBagConstraints();
		gridBagConstraints17.gridx = 1;
		gridBagConstraints17.anchor = GridBagConstraints.NORTHWEST;
		gridBagConstraints17.insets = new Insets(0, 10, 5, 0);
		gridBagConstraints17.gridy = 1;
		heightLabel = new JLabel();
		heightLabel.setText("Height :");
		GridBagConstraints gridBagConstraints23 = new GridBagConstraints();
		gridBagConstraints23.gridx = 0;
		gridBagConstraints23.gridheight = 8;
		gridBagConstraints23.insets = new Insets(5, 5, 5, 0);
		gridBagConstraints23.anchor = GridBagConstraints.NORTHWEST;
		gridBagConstraints23.fill = GridBagConstraints.BOTH;
		gridBagConstraints23.weightx = 2.0D;
		gridBagConstraints23.gridy = 0;
		playerNameLabel = new JLabel();
		playerNameLabel.setText("PLAYER");

		playerNameLabel.setFont(new Font("Arial Black", Font.BOLD, 14));
		this.setLayout(new GridBagLayout());
		Dimension dimension = new Dimension(454, 146);
		this.setSize(new Dimension(500, 157));
		this.setMinimumSize(dimension);
		this.setMaximumSize(dimension);
		this.setPreferredSize(dimension);
		this.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2,
				Color.darkGray));
		this.add(pictureLabel, gridBagConstraints23);
		this.add(playerNameLabel, gridBagConstraints);
		this.add(heightLabel, gridBagConstraints1);
		this.add(weightLabel, gridBagConstraints2);
		this.add(wageLabel, gridBagConstraints3);
		this.add(collegeLabel, gridBagConstraints4);
		this.add(heightValueLabel, gridBagConstraints31);
		this.add(weightValueLabel, gridBagConstraints41);
		this.add(wageValueLabel, gridBagConstraints5);
		this.add(collegeValueLabel, gridBagConstraints6);
		this.add(pointsLabel, gridBagConstraints7);
		this.add(assistsLabel, gridBagConstraints8);
		this.add(reboundsLabel, gridBagConstraints9);
		this.add(blocksLabel, gridBagConstraints10);
		this.add(pointsValueLabel, gridBagConstraints11);
		this.add(assistsValueLabel, gridBagConstraints12);
		this.add(reboundsValueLabel, gridBagConstraints13);
		this.add(blocksValueLabel, gridBagConstraints14);
		this.add(jerseyNumberLabel, gridBagConstraints21);
		this.add(ageLabel, gridBagConstraints17);
		this.add(ageValueLabel, gridBagConstraints37);
		this.add(getPositionLabel(), gridBagConstraints51);
		this.add(positionValueLabel, gridBagConstraints61);
		this.add(jLabel, gridBagConstraints15);
	}

	public void setPlayerValues(IPlayer player) {

		URL picURL = getClass().getResource(
				"/statistics/pictures/" + player.getImage());
		pictureLabel.setIcon(new ImageIcon(picURL));
		pictureLabel.setText("");
		playerNameLabel.setText(player.getPlayerName() + " "
				+ player.getPlayerSurname());
		jerseyNumberLabel.setText("#" + String.valueOf(player.getJerseyNo()));
		ageValueLabel.setText(String.valueOf(player.getAge()));
		positionValueLabel.setText(player.getPos());
		heightValueLabel.setText(String.valueOf(player.getHeight()));
		weightValueLabel.setText(String.valueOf(player.getWeight()));
		wageValueLabel.setText(String.valueOf(player.getWage()) + " M");
		if (player.getCollege().length() > 8) {
			collegeValueLabel.setText(player.getCollege().substring(0, 7));
		} else {
			collegeValueLabel.setText(player.getCollege());
		}
		pointsValueLabel.setText(String.valueOf(player.getPointPG()));
		assistsValueLabel.setText(String.valueOf(player.getAssistPG()));
		reboundsValueLabel.setText(String.valueOf(player.getReboundPG()));
		blocksValueLabel.setText(String.valueOf(player.getBlockPG()));
	}

	/**
	 * This method initializes positionLabel
	 * 
	 * @return javax.swing.JLabel
	 */
	private JLabel getPositionLabel() {
		if (positionLabel == null) {
			positionLabel = new JLabel();
			positionLabel.setText("Position :");
		}
		return positionLabel;
	}

} // @jve:decl-index=0:visual-constraint="3,5"
